package com.milo.concurrent;

/**
 * @author: Milogenius
 * @create: 2019-04-29 14:48
 * @description: 演示CountDownLatch的用法
 * CountDownLatch允许一个或多个线程等待其他线程完成操作
 **/
public class JoinCountDownLatchTest {

    public static void main(String[] args) throws InterruptedException {
        Thread parser1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("parser1 finish");
            }
        });
        Thread parser2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("parser2 finish");
            }
        });
        parser1.start();
        parser2.start();
        parser1.join();
        parser2.join();
        System.out.println("all parser finish");
    }
}
